package yja.gzw.app.activity

import android.widget.Toast
import androidx.lifecycle.Observer
import androidx.recyclerview.widget.LinearLayoutManager
import yja.gzw.app.R
import yja.gzw.app.adapter.Haoyouadapter
import yja.gzw.app.adapter.ShengqingAdapter
import yja.gzw.app.base.BaseActivity
import yja.gzw.app.databinding.ActivityShengqingfankuiBinding
import yja.gzw.app.model.UserData
import yja.gzw.app.viewmodel.Mainviewmodel

class ShengqingfankuiActivity :BaseActivity<Mainviewmodel, ActivityShengqingfankuiBinding>(R.layout.activity_shengqingfankui){

    private lateinit var dimingada: ShengqingAdapter
    override fun initView() {


        viewmodel.onshengqingliebiaowang(UserData.token)

    }

    override fun dataObservese() {
       viewmodel.onshengqingliebiao.observe(this, Observer {
          if(it.code==1){
              binding.review.layoutManager=
                  LinearLayoutManager(this)
              dimingada= ShengqingAdapter(this,it.data)
              binding.review.adapter= dimingada


          }else{
              Toast.makeText(this,it.msg, Toast.LENGTH_SHORT).show()
          }
       })


    }
}